<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  
 </body>
</html>
<script>
//div#demo.demo转化成<div id="demo" class="demo"></div>
//[a-z]+  [a-z0-9]+ [a-z0-9]+
var str = 'div#demo.demo';
var newstr = str.replace(/([a-z]+)#([a-z0-9]+)\.([a-z0-9]+)/g,function(match,$1,$2,$3){
	return '<' +$1+ ' id="' +$2+ '" class="' +$3+ '"></' +$1+ '>'
});
console.log(newstr);
</script>